﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace ZXthex.EditorUI
{
    public class EditorButton : EditorRectTransform
    {
        GUIStyle style;
        GUIContent label;
        public EditorButton(string text)
        {
            style = EUIStyles.Button;
            this.label = new GUIContent(text);
            sizeDelta = new Vector2(90, 30);
            onClick = new UnityEngine.UI.Button.ButtonClickedEvent();
        }

        public UnityEngine.UI.Button.ButtonClickedEvent onClick { get; set; }

        internal override void SelfGUI()
        {
            var click = GUI.Button(guiRect, label/*, style*/);
            if (click && onClick != null)
            {
                onClick.Invoke();
            }
        }
    }
}